//
//  STHairHouseCell.m
//  YiYueHairdresser
//
//  Created by zhouzhouzhou on 2018/10/9.
//  Copyright © 2018年 YuYiLian. All rights reserved.
//

#import "STHairHouseCell.h"

@implementation STHairHouseCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    self = [[[NSBundle mainBundle] loadNibNamed:@"STHairHouseCell" owner:nil options:nil] lastObject];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}

-(void)setHouseInfoWithData:(STHairHouseListModel *)data{
    
    self.starBackView.hidden = !self.type;
    self.listNumLab.hidden = self.type;
    
    NSURL *url = [NSURL URLWithString:data.storeCover?:@""];
    [self.houseImg sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"m-adv"]];
    if (data.distance > 0) {
        self.distanceLabel.text = [NSString stringWithFormat:@"%ld m",data.distance];
    }else{
        self.distanceLabel.text = @"";
    }

    
    self.nameLab.text = [NSString stringWithFormat:@"%@",data.storeName?:@""];
    self.adressLab.text = [NSString stringWithFormat:@"地址:%@",data.location?:@""];
    
    if(self.type == 1){
        NSString * num = [NSString stringWithFormat:@"接单次数:%ld次",data.servers];
        NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:num];
        [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(5,num.length-6)];
        self.listNumLab.attributedText = str;
    }
    
}

-(void)setStarView:(id)data{
    
}
     
     
@end
